红葡萄酒探索性数据分析

本次主要探索红酒品质的好坏和数据集中其他变量之间的关系。

Univariate Plots Section

本次分析的数据中包含13个变量,1599个数据。

## [1] 1599   13
## 'data.frame':    1599 obs. of  13 variables:
##  $ X                   : int  1 2 3 4 5 6 7 8 9 10 ...
##  $ fixed.acidity       : num  7.4 7.8 7.8 11.2 7.4 7.4 7.9 7.3 7.8 7.5 ...
##  $ volatile.acidity    : num  0.7 0.88 0.76 0.28 0.7 0.66 0.6 0.65 0.58 0.5 ...
##  $ citric.acid         : num  0 0 0.04 0.56 0 0 0.06 0 0.02 0.36 ...
##  $ residual.sugar      : num  1.9 2.6 2.3 1.9 1.9 1.8 1.6 1.2 2 6.1 ...
##  $ chlorides           : num  0.076 0.098 0.092 0.075 0.076 0.075 0.069 0.065 0.073 0.071 ...
##  $ free.sulfur.dioxide : num  11 25 15 17 11 13 15 15 9 17 ...
##  $ total.sulfur.dioxide: num  34 67 54 60 34 40 59 21 18 102 ...
##  $ density             : num  0.998 0.997 0.997 0.998 0.998 ...
##  $ pH                  : num  3.51 3.2 3.26 3.16 3.51 3.51 3.3 3.39 3.36 3.35 ...
##  $ sulphates           : num  0.56 0.68 0.65 0.58 0.56 0.56 0.46 0.47 0.57 0.8 ...
##  $ alcohol             : num  9.4 9.8 9.8 9.8 9.4 9.4 9.4 10 9.5 10.5 ...
##  $ quality             : int  5 5 5 6 5 5 5 7 7 5 ...
##        X          fixed.acidity   volatile.acidity  citric.acid   
##  Min.   :   1.0   Min.   : 4.60   Min.   :0.1200   Min.   :0.000  
##  1st Qu.: 400.5   1st Qu.: 7.10   1st Qu.:0.3900   1st Qu.:0.090  
##  Median : 800.0   Median : 7.90   Median :0.5200   Median :0.260  
##  Mean   : 800.0   Mean   : 8.32   Mean   :0.5278   Mean   :0.271  
##  3rd Qu.:1199.5   3rd Qu.: 9.20   3rd Qu.:0.6400   3rd Qu.:0.420  
##  Max.   :1599.0   Max.   :15.90   Max.   :1.5800   Max.   :1.000  
##  residual.sugar     chlorides       free.sulfur.dioxide
##  Min.   : 0.900   Min.   :0.01200   Min.   : 1.00      
##  1st Qu.: 1.900   1st Qu.:0.07000   1st Qu.: 7.00      
##  Median : 2.200   Median :0.07900   Median :14.00      
##  Mean   : 2.539   Mean   :0.08747   Mean   :15.87      
##  3rd Qu.: 2.600   3rd Qu.:0.09000   3rd Qu.:21.00      
##  Max.   :15.500   Max.   :0.61100   Max.   :72.00      
##  total.sulfur.dioxide    density             pH          sulphates     
##  Min.   :  6.00       Min.   :0.9901   Min.   :2.740   Min.   :0.3300  
##  1st Qu.: 22.00       1st Qu.:0.9956   1st Qu.:3.210   1st Qu.:0.5500  
##  Median : 38.00       Median :0.9968   Median :3.310   Median :0.6200  
##  Mean   : 46.47       Mean   :0.9967   Mean   :3.311   Mean   :0.6581  
##  3rd Qu.: 62.00       3rd Qu.:0.9978   3rd Qu.:3.400   3rd Qu.:0.7300  
##  Max.   :289.00       Max.   :1.0037   Max.   :4.010   Max.   :2.0000  
##     alcohol         quality     
##  Min.   : 8.40   Min.   :3.000  
##  1st Qu.: 9.50   1st Qu.:5.000  
##  Median :10.20   Median :6.000  
##  Mean   :10.42   Mean   :5.636  
##  3rd Qu.:11.10   3rd Qu.:6.000  
##  Max.   :14.90   Max.   :8.000

绝大多数葡萄酒的等级分别为5和6,这是为什么呢?接下来看看其他变量的分部情况。 注解:本次分析中葡萄酒的等级为0到10,数值越大表示质量越好。

绝大多数葡萄酒中fixed.acidity的含量主要集中在7到11之间。

绝大多数葡萄酒中volatile.acidity的含量主要集中在0.2到0.7之间。

绝大多数葡萄酒中citric.acid的含量主要集中在0到0.5之间,有一部分含量为0。

绝大多数葡萄酒中residual.sugar的含量主要集中在1到3之间。

绝大多数葡萄酒中chlorides的含量主要集中在0.05到0.11之间。

绝大多数葡萄酒中free.sulfur.dioxide的含量主要集中在0到25之间。

绝大多数葡萄酒中total.sulfur.dioxide的含量主要集中在0.995到1之间。

绝大多数葡萄酒中density的含量主要集中在0.995到1之间。

绝大多数葡萄酒中pH的含量主要集中在3到3.6之间。

绝大多数葡萄酒中sulphates的含量主要集中在0.5到0.75之间。

绝大多数葡萄酒中alcohol的含量主要集中在9到11之间。

##    Poor Average    Good 
##      63    1319     217

由于红酒的品质等级quality有6级,太过于分散,不便于分析,所以引入新变量rating。

Univariate Analysis

What is the structure of your dataset?

该数据集包含1599瓶葡萄酒的数据,含有13个特征(X, fixed.acidity, volatile.acidity, citric.acid, residual.sugar, chlorides, free.sulfur.dioxide, total.sulfur.dioxide, density, pH, sulphates, alcohol, quality), 其中quality为有序因子变量。
(坏) —————-> (好)
quality:3, 4, 5, 6, 7, 8
其他发现:
部分葡萄酒中citric.acid的含量为0。

What is/are the main feature(s) of interest in your dataset?

在这些数据中最感兴趣的是quality,volatile.acidity,free.sulfur.dioxide,sulphates, alcohol。我想确定葡萄酒的品质好坏是否与我所感兴趣的几种物质的含量相关。

What other features in the dataset do you think will help support your investigation into your feature(s) of interest?

fixed.acidity, citric.acid,residual.sugar,chlorides,pH的含量也会影响葡萄酒的品质, 其中fixed.acidity, citric.acid, pH对葡萄酒品质的影响更为主要。

Did you create any new variables from existing variables in the dataset?

创建了新的变量rating来表示葡萄酒的品质。

Of the features you investigated, were there any unusual distributions? Did you perform any operations on the data to tidy, adjust, or change the form of the data? If so, why did you do this?

没有。

Bivariate Plots Section

##       cor 
## 0.1240516

从图中可以看出,fixed.acidity含量和红酒品质呈现出直接相关关系, 两者相关性为0.124

##        cor 
## -0.3905578

从图中可以看出,volatile.acidity含量和红酒品质呈现出间接相关关系, 两者相关性为-0.391

##       cor 
## 0.2263725

从图中可以看出,citric.acid含量和红酒品质呈现出直接相关关系,两者相关性为0.226

##        cor 
## 0.01373164

目前从图中看不出residual.sugar含量和红酒整体品质的关系,两者相关性为0.014

##        cor 
## -0.1289066

目前从图中看不出chlorides含量和红酒整体品质的关系,两者相关性为-0.129

##         cor 
## -0.05065606

目前从图中看不出free.sulfur.dioxide含量和红酒整体品质的关系,两者相关性为-0.051

##        cor 
## -0.1851003

目前从图中看不出total.sulfur.dioxide含量和红酒整体品质的关系,两者相关性为-0.185

##        cor 
## -0.1749192

目前从图中看不出density含量和红酒整体品质的关系,两者相关性为-0.175

##         cor 
## -0.05773139

从图中可以看出pH值和红酒品质呈现出间接相关关系,两者相关性为-0.058

##       cor 
## 0.2513971

从图中可以看出sulphates值和红酒品质呈现出直接相关关系,两者相关性为0.251

##       cor 
## 0.4761663

目前从图中看不出alcohol含量和红酒整体品质的关系,两者相关性为0.476

##       cor 
## 0.6717034

从图中可以看出,fixed.acidity和citric.acid之间有一定的关系。

##        cor 
## -0.6829782

从图中可以看出,fixed.acidity和pH之间有一定的关系。

##        cor 
## -0.5419041

从图中可以看出,citric.acid和pH之间有一定的关系。

Bivariate Analysis

Talk about some of the relationships you observed in this part of the investigation. How did the feature(s) of interest vary with other features in the dataset?

fixed.acidity, citric.acid, sulphates, alcohol和红酒的品质呈现出直接相关关系, volatile.acidity, pH和红酒的品质呈现出间接相关关系。

Did you observe any interesting relationships between the other features (not the main feature(s) of interest)?

fixed.acidity,citric.acid,pH三者之间的含量互相影响。 三者之间的相关性分别为0.672,-0.683,-0.542

What was the strongest relationship you found?

下面变量和红酒的品质相关性比较高:
volatile.acidity: -0.391
citric.acid: 0.226
sulphates: 0.251
alcohol: 0.476
fixed.acidity,citric.acid,pH三者之间的含量也高度相关, 分别为0.672,-0.683,-0.542

Multivariate Plots Section

从图中可以发现,大多数品质为Good的红酒中citric.acid含量偏向于其平均值, volatile.acidity含量比较低。大多数品质为Poor的红酒中citric.acid含量比较低, volatile.acidity含量偏向于其平均值之上。

Multivariate Analysis

Talk about some of the relationships you observed in this part of the investigation. Were there features that strengthened each other in terms of looking at your feature(s) of interest?

在最初分析时发现由于Poor,Average,Good三者混在一起,而且Average样本值数量比较多, 导致很难从图中观察相关变量对红酒品质的影响, 所以在后面的观察中rating只保留Poor,Good。 最后发现大多数品质为Good的红酒中citric.acid含量偏向于其平均值, volatile.acidity含量比较低。大多数品质为Poor的红酒中citric.acid含量比较低, volatile.acidity含量偏向于其平均值之上。

Were there any interesting or surprising interactions between features?

在之前的双变量分析时发现,sulphates和红酒的品质呈现出正相关, 但是当rating只保留Poor和Good的时候, 却很难通过sulphates的含量去区分红酒品质的好坏。

OPTIONAL: Did you create any models with your dataset? Discuss the strengths and limitations of your model.

没有


Final Plots and Summary

Plot One

Description One

大多数葡萄酒的品质等级集中在5和6,虽然Quality等级分布范围为0到10, 但本次红酒样本数据中没有Quality为0,1,2,9,10的红酒。

Plot Two

Description Two

在品质比较好的葡萄酒中,fixed.acidity和citric.acid含量比较高, volatile.acidity含量比较低,PH值也比其他品质葡萄酒要低。虽然酸的含量越多, pH值越低,但是只有fixed.acidity和citric.acid的含量增加时才有利于葡萄酒品质的提高。

Plot Three

Description Three

通过观察发现大多数品质为Good的红酒中citric.acid含量偏向于其平均值, volatile.acidity含量比较低。大多数品质为Poor的红酒中citric.acid含量比较低, volatile.acidity含量偏向于其平均值之上。


Reflection

本次主要探索红酒品质的好坏和数据集中其他变量之间的关系。

本次分析的数据中包含13个变量,1599个数据。 在单变量分析部分并不能明确的看出哪种变量对葡萄酒的品质有较大的影响。 在双变量分析部分发现Quality的数值过于分散,不利于接下来的分析, 所以引入了新变量rating,rating中包含Poor, Average, Good三个等级。

在双变量分析部分发现:fixed.acidity, citric.acid, sulphates, alcohol 和红酒的品质呈现出直接相关关系,volatile.acidity, p H和红酒的品质呈现出间接相关关系。和红酒的品质相关性比较高的变量如下:
volatile.acidity: -0.391
citric.acid: 0.226
sulphates: 0.251
alcohol: 0.476

在多变量分析部分发现:大多数品质为Good的红酒中citric.acid含量偏向于其平均值, volatile.acidity含量比较低。大多数品质为Poor的红酒中citric.acid含量比较低, volatile.acidity含量偏向于其平均值之上。

在本次探索分析最初阶段,由于没有提前了解红葡萄酒相关的知识,导致一头雾水,最后去 了解了葡萄酒的相关知识才有了眉目。

通过本次探索性数据分析发现,引入适当的新变量不仅会使各变量之间的关系更加明了, 同时也会使分析过程更加容易,同时了解所分析对象的背景知识也显得十分重要。